package com.robot;

import com.robot.common.enums.*;
import com.robot.common.utils.JsonUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.boot.autoconfigure.security.servlet.SecurityFilterAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.sql.DataSource;


@Slf4j
@MapperScan({"com.robot.dao.mapper"})
@ComponentScan(basePackages = {"com.robot.service","com.robot.dao","com.robot.common","com.robot","com.robot.config","com.robot.controller","algorithm","com.robot.interceptors","com.robot.repository"})
@SpringBootApplication(scanBasePackages = "com.robot",exclude = {DataSourceAutoConfiguration.class, SecurityAutoConfiguration.class, SecurityFilterAutoConfiguration.class})
@EnableTransactionManagement
@EnableScheduling
public class RobotWebApplication implements WebMvcConfigurer {
//    @Autowired
//    private SqlSessionFactoryBean sqlSessionFactoryBean;
    //测试代码 xxxxxxxxxxxxxxxxxxx
    public static void main(String[] args)  {
        SpringApplication.run(RobotWebApplication.class, args);

        log.info("注册中心地址:");
        log.info("\n----------------------------------------------------------\n\t" +
                        "com.example RobotWebApplication '{}' is running! Access URLs:\n\t" +
                        "Local: \t\thttp://local.robot.com:{}\n\t" +
                        "Swagger API:http://127.0.0.1:{}/swagger-ui.html\n\t" +
                        "Druid index:http://127.0.0.1:{}/druid/index.html\n\t" +
                        "WSDL:http://127.0.0.1:{}/wsdl/sap?wsdl\n" +
                        "----------------------------------------------------------"
                ,
                "robot",
                "20300",
                "20300",
                "20300",
                "20300",
                "20300");
//        ApplicationContext context = new AnnotationConfigApplicationContext(YourConfigurationClass.class);

//        SqlSessionFactoryBean factoryBean = context.getBean(SqlSessionFactoryBean.class);
    }
}
